package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.List;


/**
 * The persistent class for the DEPT database table.
 * 
 */
@Entity
@NamedQuery(name="Dept.findAll", query="SELECT d FROM Dept d")
public class Dept implements Serializable {
	private static final long serialVersionUID = 1L;

	@SequenceGenerator(name="DEPT_DEPTID_GENERATOR", sequenceName="SEQ_DEPT")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="DEPT_DEPTID_GENERATOR")
	@Id
	@Column(name="DEPT_ID")
	private long deptId;

	@Column(name="DEPT_DESCRIBE")
	private String deptDescribe;

	@Column(name="DEPT_NAME")
	private String deptName;

	//bi-directional many-to-one association to Emp
	@OneToMany(mappedBy="dept")
	@JSONField(serialize = false)
	private List<Emp> emps;

	public Dept() {
	}

	public long getDeptId() {
		return this.deptId;
	}

	public void setDeptId(long deptId) {
		this.deptId = deptId;
	}

	public String getDeptDescribe() {
		return this.deptDescribe;
	}

	public void setDeptDescribe(String deptDescribe) {
		this.deptDescribe = deptDescribe;
	}

	public String getDeptName() {
		return this.deptName;
	}

	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	public List<Emp> getEmps() {
		return this.emps;
	}

	public void setEmps(List<Emp> emps) {
		this.emps = emps;
	}

	public Emp addEmp(Emp emp) {
		getEmps().add(emp);
		emp.setDept(this);

		return emp;
	}

	public Emp removeEmp(Emp emp) {
		getEmps().remove(emp);
		emp.setDept(null);

		return emp;
	}

}